<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<!DOCTYPE html>
<html>
	<head>
		<title><tiles:insertAttribute name="title" /></title>
		
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		
		<spring:url value="/css" var="cssUrl"></spring:url>
		<spring:url value="/js/extjs" var="extjs"></spring:url>
		<spring:url value="/js/ricerca" var="ricercajs"></spring:url>
		
		<link rel="stylesheet" type="text/css" href="${cssUrl}/kube.min.css" />
		<link rel="stylesheet" type="text/css" href="${cssUrl}/master.css"  media="screen, projection"/>
		<link rel="stylesheet" type="text/css" href="${cssUrl}/smoothness/jquery-ui-1.10.3.custom.css" />
		
		<script src="${extjs}/ext-all.js"></script>
		<link rel="stylesheet" type="text/css" href="${extjs}/resources/ext-theme-classic/ext-theme-classic-all.css" />	
		<script src="${ricercajs}/ricerca-ext.js"></script>		
		<c:set var="mainDisplay" value="block" ></c:set>
		<c:if test="${fn:contains(flowExecutionUrl,'/ricerca')}">
			<c:set var="mainDisplay" value="none"></c:set>	
			<script>
				Ext.onReady(function(){					
					var sideMenu = createRicercaMenu('ROLE_ADMIN','ricerca');	
					document.getElementById("mainPage").style.display="block";
				});		
			</script>
		</c:if>
		<c:if test="${fn:contains(flowExecutionUrl,'/candidato')}">
			<sec:authorize ifAllGranted="ROLE_ADMIN">
				<c:set var="mainDisplay" value="none"></c:set>	
				<script>
					Ext.onReady(function(){					
						var sideMenu = createRicercaMenu('ROLE_ADMIN','candidato');	
						document.getElementById("mainPage").style.display="block";
					});		
				</script>
			</sec:authorize>			
		</c:if>
		<c:if test="${fn:contains(flowExecutionUrl,'/azienda')}">
			<sec:authorize ifAllGranted="ROLE_ADMIN">
				<c:set var="mainDisplay" value="none"></c:set>	
				<script>
					Ext.onReady(function(){					
						var sideMenu = createRicercaMenu('ROLE_ADMIN','azienda');	
						document.getElementById("mainPage").style.display="block";
					});		
				</script>
			</sec:authorize>
		</c:if>
		<c:if test="${fn:contains(flowExecutionUrl,'/opportunita')}">
			<sec:authorize ifAllGranted="ROLE_ADMIN">
				<c:set var="mainDisplay" value="none"></c:set>	
				<script>
					Ext.onReady(function(){					
						var sideMenu = createRicercaMenu('ROLE_ADMIN','opportunita');	
						document.getElementById("mainPage").style.display="block";
					});		
				</script>
			</sec:authorize>
		</c:if>
		<c:if test="${fn:contains(flowExecutionUrl,'/admin')}">
			<sec:authorize ifAllGranted="ROLE_ADMIN">
				<c:set var="mainDisplay" value="none"></c:set>	
				<script>
					Ext.onReady(function(){					
						var sideMenu = createRicercaMenu('ROLE_ADMIN','admin');	
						document.getElementById("mainPage").style.display="block";
					});		
				</script>
			</sec:authorize>
		</c:if>
		
		<spring:url value="/js" var="jsUrl"></spring:url>
		<spring:url value="/images" var="imagesUrl"></spring:url>
		<script src="${jsUrl}/jquery-1.10.2.js"></script>
		<script src="${jsUrl}/jquery-ui-1.10.3.custom.js"></script>
		<script src="${jsUrl}/jquery.ui.datepicker-it.js"></script>
		<script src="${jsUrl}/jquery.validate.js"></script>
		<script src="${jsUrl}/additional-methods.js"></script>
		<script src="${jsUrl}/messages_it.js"></script>
		<script src="${jsUrl}/kube.buttons.js"></script>
		<style>
			.btn {
			  text-decoration: none;
			  color: #000;
			  border-radius: 2px;
			  font-family: 'PT Sans', Arial, "Helvetica Neue", Helvetica, Tahoma, sans-serif;
			  border: 1px solid #cccccc;
			  border-bottom-color: #b3b3b3;
			  line-height: 1;
			  padding: .7em 1.1em .6em 1.1em;
			  font-weight: bold;
			  font-size: .85em;
			  background-color: #f1f1f1;
			  background-image: -moz-linear-gradient(top, #fcfcfc, #e0e0e0);
			  background-image: -ms-linear-gradient(top, #fcfcfc, #e0e0e0);
			  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fcfcfc), to(#e0e0e0));
			  background-image: -webkit-linear-gradient(top, #fcfcfc, #e0e0e0);
			  background-image: -o-linear-gradient(top, #fcfcfc, #e0e0e0);
			  background-image: linear-gradient(top, #fcfcfc, #e0e0e0);
			  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fcfcfc', endColorstr='#e0e0e0', GradientType=0);
			  text-shadow: 0 1px 0 #ffffff;
			  box-shadow: none;
			}
		</style>
		
	</head>
<body class="mainpage" id="mainPage" style="display:${mainDisplay}">

	<div class="wrap" style="background-image:url(${imagesUrl}/sfondo.jpg);background-size:cover;">
		<header id="header">
			<tiles:insertAttribute name="header" />
		</header>
		<table cellPadding="0" cellSpacing="0">
			<tr>
				<td style="width:150px;height:200px;padding:0;border:0" >
					<table cellPadding="0" cellSpacing="0">
						<tr style="height:29px;padding:0;border:0"">
							<td>
								&nbsp;
									<form:form id="navigationForm" method="post" style="dispaly:none;margin-bottom:0px" action="${flowExecutionUrl}"
										commandName="navigation">
									</form:form>
									<form:form id="printForm" method="post" style="dispaly:none;margin-bottom:0px" action="${flowExecutionUrl}"
										commandName="printing">
									</form:form>
							</td>
						</tr>
						<tr>
							<td id="sideMenu" style="padding:0;border:0">
							</td>
						</tr>
					</table>
				</td>
				<td>
					<div id="main">
						<div class="units-row" style="margin:0 auto;height:600px; display:table;">				
							<div class="unit-80" style="width:100%">
								<tiles:insertAttribute name="body" />
							</div>
						</div>
					</div>
				</td>
			</tr>
		</table>
		<footer id="footer">
			<tiles:insertAttribute name="footer" />
		</footer>
	</div>

</body>
</html>